﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
using System.Media;
using System.Collections;
using System.Diagnostics;
using System.ComponentModel;


namespace Paralell_Test
{
    class Program
    {
        static void Main(string[] args)
        {
           
            
            const  int max = 3000;
            int count1 = Environment.TickCount;
           
            Parallel.For(0, max, i =>
            {
                for (int j = 0; j <= 1000;j++ )
                {
                    Random a = new Random();
                    a.Next();
                }
            });
            int count2 = Environment.TickCount;
            Console.WriteLine("The Paralell time used is {0}", count2 - count1);

            count1 = Environment.TickCount;
            for (int a = 0; a <= max - 1; a++)
            {
                for (int j = 0; j <= 1000; j++)
                {
                    Random n = new Random();
                    n.Next();
                }
            }
            count2 = Environment.TickCount;
            Console.WriteLine("The commom time used is {0}", count2 - count1);

            Process.Start("notepad");
            Console.Write();
            Console.WriteLine();
            Console.ReadLine();

            
        }
    }
}
